
import React, { useState } from 'react'
import "./index.scss"
import { useNavigate } from "react-router-dom"
const bg = require("../../assets/icon3.jpg")


const Login = () => {
  const [username, setUsername] = useState("")
  const [password, setPassword] = useState("")
  const navigate = useNavigate()
  const tologin = () =>{
    if(username === "") return alert("账号输入不能为空")
    if(password === "") return alert("密码输入不能为空")


  }
  const tosign = () =>{
    navigate("")
  }
  return (
    <div className='login_box'>
      <img className='login_background' src={bg} alt="" />
      <div className='mark'>
        <h2>登录</h2>
        <div>账号：<input type="text" value={username} placeholder='请输入账号' onChange={(e)=>{
            setUsername(e.target.value)
        }}/></div>
        <div>密码：<input type="text" value={password} placeholder='请输入密码'  onChange={(e)=>{
            setPassword(e.target.value)
        }}/></div>
        <button onClick={()=>tologin()}>登录</button> 
        <span onClick={()=>tosign()}>去注册</span>
      </div>
    </div>
  )
}

export default Login